{template 'common/header3'}
<style>
.sub-search input,.sub-search select{margin-bottom:0;}
 #main{margin:100px auto;}
 #main .info{line-height:20px; border-bottom:1px dashed #FC0;}
 #main .info a{color:#666; text-decoration:none; position:relative; display:block;}
 #main .info a div{display:none;}
 #main .info a:hover{ visibility:visible; color:#333;}
 #main .info a:hover div{position:absolute; left:80px; top:-50px; border:1px solid #D4D4D4;background-color:#F2F2F2; display:block; width:200px; height:180px; color:#333; overflow:hidden;text-align:left; padding:10px;}
 </style>
    <div class="main">
		<div class="stat">
			<div class="stat-div">
				<div class="navbar navbar-static-top">
					<div class="navbar-inner">
						<span class="brand">幸运拆礼盒密卡数据管理{if $rid!=''}[{$guize}]{/if}</span>
                        {if $rid!=''}
						<div class="pull-left">
							<ul class="nav">
								<li><a href="{php echo create_url('site/module', array('do' => 'userlist', 'name' => 'stonefish_chailihe','id'=>$rid))}">查看粉丝达人</a></li>
								<li><a href="{php echo create_url('site/module', array('do' => 'sharedata', 'name' => 'stonefish_chailihe','id'=>$rid))}">查看分享数据</a></li>
								<li><a href="{php echo create_url('site/module', array('do' => 'prizedata', 'name' => 'stonefish_chailihe','id'=>$rid))}">查看奖品数据</a></li>
								<li><a href="{php echo create_url('site/module', array('do' => 'awardinglist', 'name' => 'stonefish_chailihe','id'=>$rid))}">兑奖地点数据</a></li>
								<li class="active"><a href="{php echo create_url('site/module', array('do' => 'awardmika', 'name' => 'stonefish_chailihe','id'=>$rid))}">查看密卡数据</a></li>
								<li class="active"><a href="{php echo create_url('site/module', array('do' => 'downloadmika', 'name' => 'stonefish_chailihe','rid'=>$rid))}"><i class="icon-download-alt"></i>导出密卡数据</a></li>
							</ul>
						</div>
						{/if}										
					</div>
				</div>
				<div class="sub-item">
					<form action="" method="post">
					<div class="pull-right">
						<input class="btn btn-primary" type="submit" value="搜索">
					</div>
					<div class="pull-left">
						<input name="act" type="hidden" value="{$_GPC['act']}" />
						<input name="do" type="hidden" value="{$_GPC['do']}" />
						类型：<input type="text" class="span2 kw" name="keywordtype" value="{$_GPC['keywordtype']}" placeholder="请输入类型">
						密卡串：<input type="text" class="span2 kw" name="keywordmika" value="{$_GPC['keywordmika']}" placeholder="请输入密卡串">{if $rid==''}
						规则ID：<input type="text" class="span2 kw" name="keywordid" value="{$_GPC['keywordid']}" placeholder="请输入规则ID">{/if}
					</div>
					</form>
				</div>
	
				<div class="sub-item" id="table-list">
					<h4 class="sub-title">幸运拆礼盒密卡数据  |  总数:{$total}</h4>
					<form action="" method="post" onsubmit="">
					<div class="sub-content">
						<table class="table table-hover">
							<thead class="navbar-inner">
								<tr>
									<th style="width:40px;" class="row-first">选择</td>
									<th style="width:120px;">礼盒名称</th>
									<th style="width:150px;">奖品名称</th>					
									<th>中奖人</th>
									{if $rid==''}<th style="width:40px;">规则</th>{/if}
									<th style="width:80px;">类型</th>
									<th style="width:80px;">价值</th>
									<th class="row-hover">密卡串</th>
									<th style="width:100px;">激活地址</th>
									<th style="width:50px;">状态</th>
								</tr>
							</thead>
							<tbody id="main">
							{php $i=1;}
								{loop $list_giftmika $row}
								<tr>
									<td class="row-first"><input type="checkbox" name="select[]" value="{$row['id']}" /></td>
									<td>{$row['lihetitle']}</td>
									<td>{$row['title']}</td>
									<td>{$row['realname']}</td>
									{if $rid==''}<td><a href="{php echo create_url('site/module/awardmika', array('name' => 'stonefish_chailihe','id'=>$row['rid']))}">{$row['rid']}</a></td>{/if}
									<td>{$row['typename']}</td>
									<td>{$row['description']}</td>
									<td class="row-hover">{$row['mika']}</td>
									<td>{$row['activationurl']}</td>
									<td>{if $row['status']}<font color="red">已发放</font>{else}未发放{/if}</td>
								</tr>
								{php $i++;}
								{/loop}
							</tbody>
						</table>
						<table class="table">
							<tr>
								<td style="width:40px;" class="row-first"><input type="checkbox" onclick="selectall(this, 'select');" /></td>
								<td>
									<input type="submit" name="delete" value="删除" class="btn btn-primary" />
									<input type="hidden" name="token" value="{$_W['token']}" />
								</td>
							</tr>
						</table>
					</div>
				</form>
				{$pager}
				</div>
			</div>
		</div>
    </div>

<script>
$(function() {
	//详细数据相关操作
	var tdIndex;
	$("#table-list thead").delegate("th", "mouseover", function(){
		if($(this).find("i").hasClass("")) {
			$("#table-list thead th").each(function() {
				if($(this).find("i").hasClass("icon-sort")) $(this).find("i").attr("class", "");
			});
			$("#table-list thead th").eq($(this).index()).find("i").addClass("icon-sort");
		}
	});
	$("#table-list thead th").click(function() {
		if($(this).find("i").length>0) {
			var a = $(this).find("i");
			if(a.hasClass("icon-sort") || a.hasClass("icon-caret-up")) { //递减排序
				/*
					数据处理代码位置
				*/
				$("#table-list thead th i").attr("class", "");
				a.addClass("icon-caret-down");
			} else if(a.hasClass("icon-caret-down")) { //递增排序
				/*
					数据处理代码位置
				*/
				$("#table-list thead th i").attr("class", "");
				a.addClass("icon-caret-up");
			}
			$("#table-list thead th,#table-list tbody:eq(0) td").removeClass("row-hover");
			$(this).addClass("row-hover");
			tdIndex = $(this).index();
			$("#table-list tbody:eq(0) tr").each(function() {
				$(this).find("td").eq(tdIndex).addClass("row-hover");
			});
		}
	});
});
</script>
{template 'common/footer'}